import { answerController, IAnswerList } from "./answer";

export const ServerPort = 4096;
export const TOKEN = "Token"; // 微信服务器配置 Token
export const OPENAI_KEY = ""; // OpenAI 的 Key
export const OPENAI_MODEL = "gpt-3.5-turbo"; // 使用的 AI 模型
export const OPENAI_MAX_TOKEN = 1024; // 最大 token 的值

export const LIMIT_HISTORY_MESSAGES = 50; // 限制历史会话最大条数
export const CONVERSATION_MAX_AGE = 60 * 60 * 1000; // 同一会话允许最大周期，默认：1 小时
export const ADJACENT_MESSAGE_MAX_INTERVAL = 10 * 60 * 1000; //同一会话相邻两条消息的最大允许间隔时间，默认：10 分钟

export const UNSUPPORTED_MESSAGE_TYPES = {
  image: "暂不支持图片消息",
  voice: "暂不支持语音消息",
  video: "暂不支持视频消息",
  music: "暂不支持音乐消息",
  news: "暂不支持图文消息",
};
// console.log(answerController);
export const baseMessage: IAnswerList = [
  {
    label: "查看上一次问题的回复",
    name: "1",
    value: "lastQuestion",
  },
  {
    label: "清除上下文",
    return: "✅ 记忆已清除",
    name: "清除",
    value: "clear",
  },
  {
    label: "获取指令指南",
    name: "帮助",
    value: "help",
  },
  {
    label: "联系本人",
    name: "阿宇",
    return: `有问题请联系个人微信： xyu20001024 长按复制，备注来意
        `,
    value: "wechat",
  },
  {
    label: "获取我的主页",
    name: "主页",
    return: `主页地址：
http://website.diehunter1024.work/
如果打不开，请复制到浏览器打开。`,
    value: "blog",
  },
  {
    label: "获取自营流量卡网站",
    name: "流量卡",
    return: `自营流量卡网站：
http://website.diehunter1024.work/card.html
如果打不开，请复制到浏览器打开。`,
    value: "card",
  },
  {
    label: "空余时间挣外快，成为流量卡代理，动动手指就能搞副业",
    name: "代理",
    return: `加入我们，成为分销
https://gantanhao.vip/gth/#/register?supplier_id=p2W29w6dM4
如果打不开，请复制到浏览器打开。`,
    value: "proxy",
  },
  {
    label: "获取书签",
    name: "书签",
    return: `个人书签：
http://website.diehunter1024.work/bookmarks/index.html
如果打不开，请复制到浏览器打开。`,
    value: "bookmarks",
  },
  {
    label: "电影相关网站",
    name: "电影",
    return: `电影相关：
        http://website.diehunter1024.work/blog_website/2024/06/03/%E7%94%B5%E5%BD%B1%E7%BD%91%E7%AB%99%E6%B1%87%E6%80%BB/
如果打不开，请复制到浏览器打开。`,
    value: "movie",
  },
  {
    label: "获取更多指令...",
    name: "更多",
    value: "more",
  },
];
export const getMessageList = async () => {
  return (await answerController.get()) ?? [];
};
export const WAIT_MESSAGE = `处理中 ... \n\n请稍等几秒后发送【1】查看回复`;
export const NO_MESSAGE = `暂无内容，请稍后回复【1】再试`;
export const CLEAR_MESSAGE = `✅ 记忆已清除`;
export const HELP_MESSAGE = `感谢你的关注！
指令使用指南
Usage:${baseMessage.map((it) => {
  const { name, label } = it;
  return `\n回复：“${name}”   ${label}`;
})}\n公众号已接入ChatGPT，快来与我对话吧！
\n发送其他消息即可与GPT聊天
`;

export const GET_MORE_MESSAGE = async () => {
  const more = await getMessageList();
  return `其他指令使用指南:
  ${more.map((it) => {
    const { name, label } = it;
    return `\n回复：“${name}”   ${label}`;
  })}
  `;
};

console.log(HELP_MESSAGE);
GET_MORE_MESSAGE().then(console.log);
